<template>
  <div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    to: {
      type: String,
      require: true
    }
  },
  mounted() {
    const toEl =  document.querySelector(this.to)
    if(toEl) {
      toEl.appendChild(this.$scopedSlots.default()[0].elm)
    }
  },
  destroyed() {
    const toEl = document.querySelector(this.to)
    if (toEl) {
      toEl.removeChild(this.$scopedSlots.default()[0].elm)
    }
  }
}
</script>